import java.util.Scanner;

public class Test {

    public static void main3(String[] args) {
        //多组输入
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()){
            int age = scanner.nextInt();
            System.out.println(age);        //ctrl+d结束读取
        }

    }
    public static void main2(String[] args) {

        Scanner scanner = new Scanner(System.in);

        System.out.println("请输入你的年龄:");
        int age = scanner.nextInt();
        System.out.println("年龄:"+age);

        scanner.nextLine();//读取回车，不加这条语句，就不会有输入姓名操作
        System.out.println("请输入你的姓名:");
        String name = scanner.nextLine();       //读取一行
        System.out.println("姓名:"+name);
    }
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.println("请输入你的姓名:");
        String name = scanner.nextLine();       //读取一行
        System.out.println("姓名:"+name);

//        String name2 = scanner.next();      //next()遇到空格就读取结束
//        System.out.println(name2);

        System.out.println("请输入你的年龄:");
        int age = scanner.nextInt();
        System.out.println("年龄:"+age);

        System.out.println("请输入你的体重:");
        float weight = scanner.nextFloat();
        System.out.println("体重:"+weight);
    }
}
